//私有属性
const target = {
    name: 'ligoudan',
    _id: 11111
}

const proxy = new Proxy(target, {
    get(target, propKey, proxy) {
        if (propKey[0] === '_') {
            throw Error(`${propKey} is 私有的!`)
        }
        return Reflect.get(target, propKey, proxy)
    },
    set(target, propKey, value, proxy) {
        if (propKey[0] === '_') {
            throw Error(`${propKey} is 私有的!`)
        }
        return Reflect.set(target, propKey, value, proxy)
    }
})

console.log(proxy.name);
console.log(proxy._id);